from django.db import models

# Create your models here.


from django.db import models

from utils.base_models import BaseModel


class Tasks(BaseModel):
    """
    日报模型类
    """
    if_extension_tag = (
        (1, "是"),
        (0, "否"),
    )
    id = models.AutoField(verbose_name='id主键', primary_key=True, help_text='id主键')
    demand_id = models.IntegerField(verbose_name='需求id', help_text='需求id', null=True, default=None)
    demand_name = models.CharField('需求名称', max_length=500, help_text='需求名称', null=True, default=None)
    task_id = models.IntegerField(verbose_name='任务id', unique=True, help_text='任务id', null=True, default=None)
    task_name = models.CharField('任务名称', max_length=500, help_text='任务名称', null=True, default=None)
    task_type = models.CharField('任务类型', max_length=500, help_text='任务类型', null=True, default=None)
    version = models.CharField('项目', max_length=500, help_text='项目', null=True, default=None)
    module = models.CharField('模块', max_length=500, help_text='模块', null=True, default=None)
    status = models.CharField('任务状态', max_length=500, help_text='任务状态', null=True, default=None)
    estimate_time = models.DecimalField('预计工时', decimal_places=2, max_digits=65, help_text='预计工时', null=True,
                                        default=None)
    left_time = models.DecimalField('剩余工时', decimal_places=2, max_digits=65, help_text='剩余工时', null=True,
                                    default=None)
    est_started = models.DateField('任务预计开始日期', max_length=500, help_text='任务预计开始日期', null=True,
                                   default=None)
    deadline = models.DateField('任务结束日期', max_length=500, help_text='任务结束日期', null=True, default=None)
    if_extension = models.IntegerField(verbose_name='是否延期', choices=if_extension_tag, help_text='是否延期',
                                       default=None, null=True)
    assigned_to = models.CharField('指派人', max_length=500, help_text='指派人', null=True, default=None)

    class Meta:
        db_table = 'tb_tasks'
        verbose_name = '任务表'
        verbose_name_plural = verbose_name
        ordering = ('est_started',)
